#!/bin/sh
cd "${0%/*}" || exit                                # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_kahip
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_metis
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_scotch

#------------------------------------------------------------------------------

: ${FOAM_EXT_LIBBIN:=/usr/lib$WM_COMPILER_LIB_ARCH}  # Extra safety?
export FOAM_EXT_LIBBIN

wmake $targetType decompositionMethods
wmake $targetType decompose

if have_kahip
then
    wmake $targetType kahipDecomp
fi

if have_metis
then
    wmake $targetType metisDecomp
fi

if have_scotch
then
    wmake $targetType scotchDecomp
fi

./Allwmake-mpi $targetType $*

#------------------------------------------------------------------------------
